home *** CD-ROM | disk | FTP | other *** search
/ Aminet 31 / Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso / Aminet / comm / misc / MakeFTPScript.lha / MakeFTPScript / ARexx / MakeAMFTPScript.rexx < prev    next >
OS/2 REXX Batch file  |  1999-03-19  |  1KB  |  64 lines

  1. /* MakeAMFTPScript v1.7 by Grzegorz Fitrzyk SP9WUN (domagal@uci.agh.edu.pl)
  2.    
  3.    usage:    rx rexx:MakeAMFTPScript.rexx SOURCE/K
  4.    ex.:      rx rexx:MakeAMFTPScript.rexx ram:recent
  5.  
  6. */
  7.  
  8. parse arg source
  9.  
  10. MODE=''
  11. total=0
  12. destin='t:amftpbatch.b'
  13.  
  14. options results
  15.  
  16. if Open(loadit, source, 'Read') then do    /* Open source file.*/
  17.   if Open(Saveit, destin, 'Write') then do /* Open destination file. */
  18.     do forever
  19.       line=Readln(loadit)
  20.       if eof(loadit)~=0 then leave
  21.       if line="" then line="|"
  22.         parse var line '|'. header
  23.         if header="" then do
  24.           if line~="|" then do
  25.             call makeline
  26.           end
  27.       end
  28.     end
  29.   end; else call error_write
  30. end; else call error_read
  31.  
  32. say 'Total size of requested files 'total'KB'
  33. say 'Conversion succesfull.'
  34.  
  35. quitit:
  36. call close(saveit)
  37. call close(loadit)
  38. address command 'c:filenote 'destin' 'total'KB'
  39. exit
  40.  
  41. error_read:
  42. say 'Cant find source file: 'source
  43. call quitit
  44.  
  45. error_write:
  46. say 'Cant write destination file 'dest
  47. call quitit
  48.  
  49. makeline:
  50. parse var line filename direct size rest
  51. tt2=pos('+',size)
  52. size2=size
  53. if tt2~=0 then parse var size2 size '+'
  54. exten=right(size,1)
  55. if exten='?' then size='0K'
  56. temp=length(size)
  57. size=left(size,temp-1)
  58. size=translate(size,,' ')
  59. if exten="M" then size=size*1024
  60. total=total+size
  61. linecom='/pub/aminet/'||direct||'/'||filename||'|'||size
  62. call writeln(saveit,linecom)
  63. return
  64.